package Review;

import java.util.*;

public class Text5 {
    public static void main(String[] args) {
        TextBinaryTree binaryTree = new TextBinaryTree();
        binaryTree.root = binaryTree.createTree();
        System.out.println("==树是否为完全二叉树======");
        boolean ret2 = binaryTree.isCompleteTree(binaryTree.root);
        System.out.println(ret2);
    }
    public static void main3(String[] args) {
        TextBinaryTree binaryTree = new TextBinaryTree();
        binaryTree.root = binaryTree.createTree();
        TextBinaryTree.TreeNode ret = binaryTree.
                find(binaryTree.root, 'E');
        System.out.println("key的值：" + ret.val);

    }
    public static void main2(String[] args) {
        TextBinaryTree binaryTree = new TextBinaryTree();
        binaryTree.root = binaryTree.createTree();
        //binaryTree.preOrder(binaryTree.root);
        System.out.println();
        binaryTree.inOrder(binaryTree.root);
        System.out.println();
        binaryTree.postOrder(binaryTree.root);
        System.out.println();
        System.out.println("==================");

        System.out.println(binaryTree.size(binaryTree.root));
        int size = binaryTree.size1(binaryTree.root);
        System.out.println(size);
        System.out.println("======测试叶子节点个数=======");
        System.out.println(binaryTree.getLeafNodeCount(binaryTree.root));
        //要先运行一下这个方法，之后类成员变量才会有节点的个数
        binaryTree.leafNodeCount(binaryTree.root);
        System.out.println(binaryTree.leafCount);
        System.out.println("=======测试第k层的叶子节点的个数====");
        System.out.println(binaryTree.
                getLevelNodeCount(binaryTree.root,3));
        System.out.println("=====获取二叉树的高度======");
        System.out.println(binaryTree.getHeight(binaryTree.root));
        System.out.println("=====二叉树层序遍历");
        binaryTree.levelOrder1(binaryTree.root);
    }

    public static void main1(String[] args) {
        Queue<Integer> queue = new LinkedList<>();
        Deque<Integer> deque = new LinkedList<>();

        //ArrayDeque底层也是一个数组 数组实现的双端队列
        Deque<Integer> stack2 = new ArrayDeque<>();
        stack2.push(1);
        Deque<Integer> stack3 = new LinkedList<>();
        stack3.push(2);

        //很少用一个具体的类来实例化一个对象
        ArrayList<Integer> arrayList = new ArrayList<>();
        LinkedList<Integer> list = new LinkedList<>();
    }
}
